Spaces:
Runtime error
Runtime error
karar-shah
commited on
Commit
•
2c4e183
1
Parent(s):
30c45a5
Upload folder using huggingface_hub
Browse files- README.md +3 -9
- test_gradio.py +22 -0
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: blue
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: gradio
|
3 |
+
app_file: test_gradio.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
+
sdk_version: 3.39.0
|
|
|
|
|
6 |
---
|
|
|
|
test_gradio.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
from langchain.llms import GooglePalm
|
4 |
+
from langchain import PromptTemplate, LLMChain
|
5 |
+
|
6 |
+
|
7 |
+
llm = GooglePalm(temperature=0.1, google_api_key= "AIzaSyB5XIeNPyhIy29g4DUNZzVBKfsa-fVZtrk")
|
8 |
+
|
9 |
+
template = """Question: {question}
|
10 |
+
|
11 |
+
Answer: Let's think step by step."""
|
12 |
+
|
13 |
+
prompt_open = PromptTemplate(template=template, input_variables=["question"])
|
14 |
+
|
15 |
+
open_chain = LLMChain(prompt=prompt_open,llm = llm)
|
16 |
+
|
17 |
+
|
18 |
+
def predict(message, history):
|
19 |
+
gpt_response = open_chain.run(message)
|
20 |
+
return gpt_response
|
21 |
+
|
22 |
+
gr.ChatInterface(predict).launch(share=True)
|