Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from openfloor import (
|
|
| 6 |
UtteranceEvent, GetManifestsEvent, To
|
| 7 |
)
|
| 8 |
|
| 9 |
-
# Function to build the envelope for a manifest request using
|
| 10 |
def build_manifest_request_envelope(agent_url):
|
| 11 |
# Create conversation and sender
|
| 12 |
conversation = Conversation()
|
|
@@ -26,7 +26,7 @@ def build_manifest_request_envelope(agent_url):
|
|
| 26 |
|
| 27 |
return envelope
|
| 28 |
|
| 29 |
-
# Function to build an utterance envelope using
|
| 30 |
def build_utterance_envelope(agent_url, message_text):
|
| 31 |
# Create conversation and sender
|
| 32 |
conversation = Conversation()
|
|
@@ -140,10 +140,10 @@ def test_agent_with_envelope(agent_url):
|
|
| 140 |
return status_msg, {"error": str(e)}, "", 0
|
| 141 |
|
| 142 |
# Gradio UI with improved layout
|
| 143 |
-
with gr.Blocks(title="
|
| 144 |
gr.Markdown("""
|
| 145 |
-
# 🗣️
|
| 146 |
-
**Test [
|
| 147 |
|
| 148 |
Send **manifest** requests to get capabilities or **utterance** events for conversations.
|
| 149 |
""")
|
|
@@ -157,7 +157,7 @@ with gr.Blocks(title="OpenFloor Protocol Tester", theme=gr.themes.Soft()) as dem
|
|
| 157 |
value="",
|
| 158 |
label="Assistant Endpoint URL",
|
| 159 |
placeholder="https://your-assistant.com/openfloor",
|
| 160 |
-
info="Full URL endpoint of the
|
| 161 |
)
|
| 162 |
|
| 163 |
gr.Markdown("### 📨 Send Request")
|
|
@@ -177,7 +177,7 @@ with gr.Blocks(title="OpenFloor Protocol Tester", theme=gr.themes.Soft()) as dem
|
|
| 177 |
info="Text to send in utterance event"
|
| 178 |
)
|
| 179 |
|
| 180 |
-
send_btn = gr.Button("🚀 Send
|
| 181 |
|
| 182 |
# Right Column - Results
|
| 183 |
with gr.Column(scale=3):
|
|
@@ -191,7 +191,7 @@ with gr.Blocks(title="OpenFloor Protocol Tester", theme=gr.themes.Soft()) as dem
|
|
| 191 |
)
|
| 192 |
|
| 193 |
# Collapsible request details
|
| 194 |
-
with gr.Accordion("📤 Generated
|
| 195 |
envelope_output = gr.Code(
|
| 196 |
language="json",
|
| 197 |
label="Request JSON",
|
|
|
|
| 6 |
UtteranceEvent, GetManifestsEvent, To
|
| 7 |
)
|
| 8 |
|
| 9 |
+
# Function to build the envelope for a manifest request using Open Floor library
|
| 10 |
def build_manifest_request_envelope(agent_url):
|
| 11 |
# Create conversation and sender
|
| 12 |
conversation = Conversation()
|
|
|
|
| 26 |
|
| 27 |
return envelope
|
| 28 |
|
| 29 |
+
# Function to build an utterance envelope using Open Floor library
|
| 30 |
def build_utterance_envelope(agent_url, message_text):
|
| 31 |
# Create conversation and sender
|
| 32 |
conversation = Conversation()
|
|
|
|
| 140 |
return status_msg, {"error": str(e)}, "", 0
|
| 141 |
|
| 142 |
# Gradio UI with improved layout
|
| 143 |
+
with gr.Blocks(title="Open Floor Protocol Tester", theme=gr.themes.Soft()) as demo:
|
| 144 |
gr.Markdown("""
|
| 145 |
+
# 🗣️ Open Floor Protocol Tester
|
| 146 |
+
**Test [Open Floor](https://github.com/open-voice-interoperability/openfloor-docs)-compliant assistants using the [official Python library](https://github.com/open-voice-interoperability/openfloor-python)**
|
| 147 |
|
| 148 |
Send **manifest** requests to get capabilities or **utterance** events for conversations.
|
| 149 |
""")
|
|
|
|
| 157 |
value="",
|
| 158 |
label="Assistant Endpoint URL",
|
| 159 |
placeholder="https://your-assistant.com/openfloor",
|
| 160 |
+
info="Full URL endpoint of the Open Floor assistant"
|
| 161 |
)
|
| 162 |
|
| 163 |
gr.Markdown("### 📨 Send Request")
|
|
|
|
| 177 |
info="Text to send in utterance event"
|
| 178 |
)
|
| 179 |
|
| 180 |
+
send_btn = gr.Button("🚀 Send Open Floor Request", variant="primary", size="lg")
|
| 181 |
|
| 182 |
# Right Column - Results
|
| 183 |
with gr.Column(scale=3):
|
|
|
|
| 191 |
)
|
| 192 |
|
| 193 |
# Collapsible request details
|
| 194 |
+
with gr.Accordion("📤 Generated Open Floor Envelope", open=False):
|
| 195 |
envelope_output = gr.Code(
|
| 196 |
language="json",
|
| 197 |
label="Request JSON",
|