Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
def check_agent(pi_uid):
|
| 5 |
+
if not pi_uid:
|
| 6 |
+
return "Enter a Pi Network UID"
|
| 7 |
+
|
| 8 |
+
try:
|
| 9 |
+
response = requests.get(
|
| 10 |
+
"https://quantumpiforge.com/api/agent-traits",
|
| 11 |
+
params={"pi_uid": pi_uid}
|
| 12 |
+
)
|
| 13 |
+
if response.status_code == 200:
|
| 14 |
+
data = response.json()
|
| 15 |
+
return f"Agent found: {data.get('agent', {}).get('username', 'Unknown')}"
|
| 16 |
+
else:
|
| 17 |
+
return "Agent not found or API error"
|
| 18 |
+
except:
|
| 19 |
+
return "Cannot connect to API"
|
| 20 |
+
|
| 21 |
+
with gr.Blocks() as demo:
|
| 22 |
+
gr.Markdown("# 🟣 Quantum PiForge Judgment System")
|
| 23 |
+
uid_input = gr.Textbox(label="Pi Network UID")
|
| 24 |
+
output = gr.Textbox(label="Result")
|
| 25 |
+
btn = gr.Button("Check Agent")
|
| 26 |
+
btn.click(check_agent, inputs=[uid_input], outputs=[output])
|
| 27 |
+
|
| 28 |
+
demo.launch()
|