Spaces:
Runtime error
Runtime error
Commit
·
fb49ad8
1
Parent(s):
57e17c2
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
|
4 |
+
# Function to call the Gradio API
|
5 |
+
def call_gradio_api(user_input):
|
6 |
+
client = Client("https://traversaal-internal-rag-faiss-gpt3-5.hf.space/")
|
7 |
+
result = client.predict(user_input, api_name="/predict")
|
8 |
+
return result["output1"], result["output2"], result["output3"]
|
9 |
+
|
10 |
+
# Interface for the Gradio app
|
11 |
+
iface = gr.Interface(
|
12 |
+
fn=call_gradio_api,
|
13 |
+
inputs=gr.inputs.Textbox(lines=1, label="Input Text"),
|
14 |
+
outputs=[gr.outputs.Textbox(label="Output 1"),
|
15 |
+
gr.outputs.Textbox(label="Output 2"),
|
16 |
+
gr.outputs.Textbox(label="Output 3")]
|
17 |
+
)
|
18 |
+
|
19 |
+
# Launch the Gradio app
|
20 |
+
iface.launch()
|