LLM with flant5 updated
Browse files
app.py
CHANGED
@@ -1,4 +1,21 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
2 |
|
3 |
x = st.slider('Select a value')
|
4 |
-
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import os
|
3 |
+
|
4 |
+
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
|
5 |
|
6 |
x = st.slider('Select a value')
|
7 |
+
st.write(x, 'squared is', x * x)
|
8 |
+
|
9 |
+
# https://cobusgreyling.medium.com/langchain-creating-large-language-model-llm-applications-via-huggingface-192423883a74
|
10 |
+
# !pip install langchain[all]
|
11 |
+
template = """Question: {question}
|
12 |
+
|
13 |
+
Answer: Let's think step by step."""
|
14 |
+
prompt = PromptTemplate(template=template, input_variables=["question"])
|
15 |
+
llm=HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature":1e-10})
|
16 |
+
|
17 |
+
question = "When was Google founded?"
|
18 |
+
|
19 |
+
# print(llm.run(question))
|
20 |
+
# d=LLMChain(llm=llm,prompt=prompt)
|
21 |
+
st.write(LLMChain.run(question))
|