File size: 626 Bytes
59b3651
 
 
53cd3f0
59b3651
 
07efe6a
 
59b3651
 
07efe6a
 
59b3651
07efe6a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
import requests

API_URL = "https://hadeeratef91-complaint.hf.space/complaints/"

def submit_complaint(title, description):
    response = requests.post(API_URL, json={"title": title, "description": description})
    return response.json().get("message", "خطأ في الاتصال بالخادم")

def view_complaints():
    response = requests.get(API_URL)
    return "\n".join([f"ID: {item['id']} - {item['title']} ({item['status']})" for item in response.json()])

demo = gr.Interface(fn=submit_complaint, inputs=["text", "text"], outputs="text")
demo.launch(server_name="0.0.0.0", server_port=7860)