File size: 823 Bytes
9b2fcb8
 
fc840be
9b2fcb8
 
4c113ba
9b2fcb8
fc840be
 
 
9b2fcb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9297fa1
fc840be
 
9b2fcb8
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
import requests
import os

# Define the FastAPI endpoint
API_URL = "http://0.0.0.0:8000/predict"  # Update this based on your actual endpoint

flagging_dir = "/app/flagged" 
os.makedirs(flagging_dir, exist_ok=True)

def predict(input1, input2, input3, input4, input5, input6, input7):
    data = {
        "input1": input1,
        "input2": input2,
        "input3": input3,
        "input4": input4,
        "input5": input5,
        "input6": input6,
        "input7": input7
    }
    response = requests.post(API_URL, json=data)
    return response.json()

# Create a Gradio interface for the inputs and prediction
iface = gr.Interface(
    fn=predict,
    inputs=["number","number","number","number","number","number","number"],
    outputs="json",
    flagging_dir=flagging_dir
)

iface.launch()