Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,47 +1,19 @@
|
|
| 1 |
# =========================================================
|
| 2 |
-
# NexFrame
|
| 3 |
-
#
|
| 4 |
# =========================================================
|
| 5 |
import gradio as gr
|
| 6 |
-
import requests
|
| 7 |
-
import os
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
# --------------------------------------------------------------------------
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
"""
|
| 19 |
-
if not API_URL:
|
| 20 |
-
return "🧠 NexFrame is offline — please set NEXFRAME_API_URL in your Space settings."
|
| 21 |
-
try:
|
| 22 |
-
response = requests.post(
|
| 23 |
-
API_URL,
|
| 24 |
-
headers={"X-API-Key": API_KEY},
|
| 25 |
-
json={"query": user_input},
|
| 26 |
-
timeout=30,
|
| 27 |
-
)
|
| 28 |
-
data = response.json()
|
| 29 |
-
# Expecting JSON with an 'answer' field
|
| 30 |
-
return data.get("answer") or str(data)
|
| 31 |
-
except Exception as e:
|
| 32 |
-
return f"[Connection error: {e}]"
|
| 33 |
-
|
| 34 |
-
# ---- Simple Gradio chat interface ----
|
| 35 |
-
chat = gr.ChatInterface(
|
| 36 |
-
fn=talk_to_nexframe,
|
| 37 |
-
title="🧠 NexFrame Chat",
|
| 38 |
-
description="Rendered Frame Theory — Ask NexFrame anything.",
|
| 39 |
-
examples=[
|
| 40 |
-
["Explain gravity in Rendered Frame Theory."],
|
| 41 |
-
["What does τ_eff mean in RFT?"],
|
| 42 |
-
["How does NexFrame understand consciousness?"]
|
| 43 |
-
],
|
| 44 |
)
|
| 45 |
|
| 46 |
if __name__ == "__main__":
|
| 47 |
-
|
|
|
|
| 1 |
# =========================================================
|
| 2 |
+
# NexFrame – minimal Gradio starter
|
| 3 |
+
# (no API, just proves the Space runs)
|
| 4 |
# =========================================================
|
| 5 |
import gradio as gr
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
def echo(message):
|
| 8 |
+
# simple placeholder reply
|
| 9 |
+
return f"🧠 NexFrame received: {message}"
|
|
|
|
| 10 |
|
| 11 |
+
demo = gr.ChatInterface(
|
| 12 |
+
fn=echo,
|
| 13 |
+
title="🧠 NexFrame Chat – Offline Mode",
|
| 14 |
+
description="This simple version checks that the Space starts correctly.",
|
| 15 |
+
examples=["Hello NexFrame!", "Test message"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
if __name__ == "__main__":
|
| 19 |
+
demo.launch()
|