Spaces:
Sleeping
Sleeping
Commit
·
dbd0c03
1
Parent(s):
c8c0f45
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
from langchain import HuggingFaceHub, PromptTemplate, LLMChain
|
3 |
from langchain.memory import ConversationBufferMemory
|
|
|
|
|
|
|
|
|
4 |
|
5 |
repo_id = "tiiuae/falcon-7b-instruct"
|
6 |
|
@@ -22,7 +26,7 @@ def generate_response(question, huggingfacehub_api_token, temperature=0.6, max_n
|
|
22 |
|
23 |
inputs = [
|
24 |
gr.inputs.Textbox(label="Question"),
|
25 |
-
gr.inputs.Textbox(label="HuggingFace API Token", type="password", default=
|
26 |
gr.inputs.Slider(minimum=0.1, maximum=2.0, default=0.6, label="Temperature"),
|
27 |
gr.inputs.Slider(minimum=100, maximum=1000, default=500, label="Max New Tokens")
|
28 |
]
|
|
|
1 |
import gradio as gr
|
2 |
from langchain import HuggingFaceHub, PromptTemplate, LLMChain
|
3 |
from langchain.memory import ConversationBufferMemory
|
4 |
+
import os
|
5 |
+
|
6 |
+
# Get the HuggingFace API token from the environment variable
|
7 |
+
huggingfacehub_api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
8 |
|
9 |
repo_id = "tiiuae/falcon-7b-instruct"
|
10 |
|
|
|
26 |
|
27 |
inputs = [
|
28 |
gr.inputs.Textbox(label="Question"),
|
29 |
+
gr.inputs.Textbox(label="HuggingFace API Token", type="password", default=huggingfacehub_api_token),
|
30 |
gr.inputs.Slider(minimum=0.1, maximum=2.0, default=0.6, label="Temperature"),
|
31 |
gr.inputs.Slider(minimum=100, maximum=1000, default=500, label="Max New Tokens")
|
32 |
]
|