Rouhani2025 commited on
Commit
4634bca
·
verified ·
1 Parent(s): fcd2f21

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ # Define the Colab backend URL (replace with your actual URL from Colab)
5
+ COLAB_BACKEND_URL = "https://2af5-34-124-205-95.ngrok-free.app"
6
+
7
+ def query_falcon(prompt):
8
+ response = requests.post(COLAB_BACKEND_URL, json={"prompt": prompt})
9
+ return response.json().get("response", "Error: Unable to fetch response from Colab")
10
+
11
+ interface = gr.Interface(
12
+ fn=query_falcon,
13
+ inputs="text",
14
+ outputs="text",
15
+ title="Falcon-7B Text Generation",
16
+ description="Enter a prompt and let Falcon-7B generate text!",
17
+ )
18
+
19
+ if __name__ == "__main__":
20
+ interface.launch()