File size: 609 Bytes
4634bca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import requests

# Define the Colab backend URL (replace with your actual URL from Colab)
COLAB_BACKEND_URL = "https://2af5-34-124-205-95.ngrok-free.app"

def query_falcon(prompt):
    response = requests.post(COLAB_BACKEND_URL, json={"prompt": prompt})
    return response.json().get("response", "Error: Unable to fetch response from Colab")

interface = gr.Interface(
    fn=query_falcon,
    inputs="text",
    outputs="text",
    title="Falcon-7B Text Generation",
    description="Enter a prompt and let Falcon-7B generate text!",
)

if __name__ == "__main__":
    interface.launch()