Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,10 +50,33 @@ imdb_interface = gr.Interface(
|
|
| 50 |
description="Search IMDb for movie details."
|
| 51 |
)
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
# ----- Combine All Tabs -----
|
| 54 |
combined_tools = gr.TabbedInterface(
|
| 55 |
-
[search_bgg, game_details, hot_games, recommend_games, wiki_search, wiki_summary, wiki_page, wiki_random, imdb_interface],
|
| 56 |
-
["Search BGG", "Details", "Hot Games", "Recommend", "Wiki Search", "Wiki Summary", "Wiki Page", "Wiki Random", "IMDb Search"]
|
| 57 |
)
|
| 58 |
|
| 59 |
# ----- Launch MCP-enabled Gradio Server -----
|
|
|
|
| 50 |
description="Search IMDb for movie details."
|
| 51 |
)
|
| 52 |
|
| 53 |
+
# ----- Twitch Chat Interface -----
|
| 54 |
+
def get_twitch_chat(channel_name):
|
| 55 |
+
if not channel_name:
|
| 56 |
+
return "Please enter a channel name."
|
| 57 |
+
# Using parent=localhost for local development.
|
| 58 |
+
# In production, this needs to match the domain where the app is hosted.
|
| 59 |
+
html_content = f"""
|
| 60 |
+
<iframe id="twitch-chat-embed"
|
| 61 |
+
src="https://www.twitch.tv/embed/{channel_name}/chat?parent=localhost"
|
| 62 |
+
height="500"
|
| 63 |
+
width="100%">
|
| 64 |
+
</iframe>
|
| 65 |
+
"""
|
| 66 |
+
return html_content
|
| 67 |
+
|
| 68 |
+
twitch_interface = gr.Interface(
|
| 69 |
+
fn=get_twitch_chat,
|
| 70 |
+
inputs=gr.Textbox(label="Channel Name", placeholder="e.g., riotgames"),
|
| 71 |
+
outputs=gr.HTML(label="Twitch Chat"),
|
| 72 |
+
title="Twitch Chat",
|
| 73 |
+
description="View Twitch chat for a specific channel."
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
# ----- Combine All Tabs -----
|
| 77 |
combined_tools = gr.TabbedInterface(
|
| 78 |
+
[search_bgg, game_details, hot_games, recommend_games, wiki_search, wiki_summary, wiki_page, wiki_random, imdb_interface, twitch_interface],
|
| 79 |
+
["Search BGG", "Details", "Hot Games", "Recommend", "Wiki Search", "Wiki Summary", "Wiki Page", "Wiki Random", "IMDb Search", "Twitch Chat"]
|
| 80 |
)
|
| 81 |
|
| 82 |
# ----- Launch MCP-enabled Gradio Server -----
|