Sina Media Lab commited on
Commit
91b16c9
ยท
1 Parent(s): a1b5681
Files changed (1) hide show
  1. app.py +36 -10
app.py CHANGED
@@ -33,30 +33,56 @@ with gr.Blocks() as demo:
33
  )
34
 
35
  with gr.Column():
36
- gr.Markdown("""## ๐Ÿ“– API Usage Guide
37
- You can call this model programmatically using the Gradio external API.
 
38
 
39
- **Endpoint:**
 
 
40
  ```
41
- POST https://huggingface.co/spaces/<username>/iris-detector/run/predict
42
  ```
43
 
44
- **Request Body Example:**
 
 
45
  ```json
46
  {
47
- "data": [5.1, 3.5, 1.4, 0.2]
 
 
 
48
  }
49
  ```
50
 
51
- **Python Example:**
 
 
52
  ```python
53
  import requests
54
 
55
- url = "https://huggingface.co/spaces/<username>/iris-detector/run/predict"
56
- payload = {"data": [5.1, 3.5, 1.4, 0.2]}
57
- resp = requests.post(url, json=payload)
 
 
 
 
 
 
 
58
  print(resp.json())
59
  ```
 
 
 
 
 
 
 
 
 
60
  """)
61
 
62
  demo.launch()
 
33
  )
34
 
35
  with gr.Column():
36
+ gr.Markdown(
37
+ """
38
+ ## ๐Ÿ“– Iris Detector API Usage (FastAPI)
39
 
40
+ Your predictions can also be made programmatically using the FastAPI backend deployed at:
41
+
42
+ ### **API Endpoint**
43
  ```
44
+ POST https://tofighi-iris-detector-api.hf.space/predict
45
  ```
46
 
47
+ ---
48
+
49
+ ### **๐Ÿ“Œ JSON Request Example**
50
  ```json
51
  {
52
+ "sepal_length": 5.1,
53
+ "sepal_width": 3.5,
54
+ "petal_length": 1.4,
55
+ "petal_width": 0.2
56
  }
57
  ```
58
 
59
+ ---
60
+
61
+ ### **๐Ÿ Python Example**
62
  ```python
63
  import requests
64
 
65
+ url = "https://tofighi-iris-detector-api.hf.space/predict"
66
+
67
+ data = {
68
+ "sepal_length": 5.1,
69
+ "sepal_width": 3.5,
70
+ "petal_length": 1.4,
71
+ "petal_width": 0.2
72
+ }
73
+
74
+ resp = requests.post(url, json=data)
75
  print(resp.json())
76
  ```
77
+
78
+ ---
79
+
80
+ ### **๐Ÿ’ป cURL Example**
81
+ ```bash
82
+ curl -X POST "https://tofighi-iris-detector-api.hf.space/predict" \
83
+ -H "Content-Type: application/json" \
84
+ -d '{"sepal_length":5.1,"sepal_width":3.5,"petal_length":1.4,"petal_width":0.2}'
85
+ ```
86
  """)
87
 
88
  demo.launch()