Complaint / interface.py
Hadeeratef91's picture
Update interface.py
07efe6a verified
raw
history blame
626 Bytes
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)