Update app.py
Browse files
app.py
CHANGED
|
@@ -19,290 +19,218 @@ GENRES = [
|
|
| 19 |
"Romance", "Thriller", "Mystery", "Adventure", "Superhero"
|
| 20 |
]
|
| 21 |
|
| 22 |
-
|
| 23 |
-
"
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
VILLAIN_TYPES = [
|
| 28 |
-
"Mad Scientist", "Ancient Evil", "Corrupt Leader", "Supervillain",
|
| 29 |
-
"Betrayed Friend", "Corporate Villain", "Supernatural Threat"
|
| 30 |
-
]
|
| 31 |
-
|
| 32 |
-
PLOT_TROPES = [
|
| 33 |
-
"Race Against Time", "Quest for Artifact", "Revenge Story",
|
| 34 |
-
"Save the World", "Personal Redemption", "Discovery of Powers",
|
| 35 |
-
"Fish Out of Water", "Buddy Adventure", "Heist Plot"
|
| 36 |
-
]
|
| 37 |
-
|
| 38 |
-
def generate_sequel(original_story, sequel_start, main_actor, supporting_actors, rating, story_length=500):
|
| 39 |
-
headers = {
|
| 40 |
-
'Authorization': f'Bearer {XAI_API_KEY}',
|
| 41 |
-
'Content-Type': 'application/json'
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
cast_text = f"Starring {main_actor} as the main character."
|
| 45 |
-
if supporting_actors:
|
| 46 |
-
cast_text += f" Supporting cast: {supporting_actors}."
|
| 47 |
-
|
| 48 |
-
rating_guides = {
|
| 49 |
-
"G": "Family-friendly, no violence, no strong language",
|
| 50 |
-
"PG": "Mild violence, minimal language, some thematic elements",
|
| 51 |
-
"PG-13": "Moderate violence, some language, intense sequences",
|
| 52 |
-
"R": "Strong violence, language, adult themes",
|
| 53 |
-
"NC-17": "Explicit content, adult-only themes"
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
prompt = f"""
|
| 57 |
-
ORIGINAL STORY: {original_story}
|
| 58 |
-
SEQUEL STARTING POINT: {sequel_start}
|
| 59 |
-
CAST: {cast_text}
|
| 60 |
-
RATING: {rating} - {rating_guides[rating]}
|
| 61 |
-
|
| 62 |
-
Write an engaging sequel story with character development, plot twists, and content appropriate for {rating} rating.
|
| 63 |
-
Length: {story_length} words.
|
| 64 |
-
"""
|
| 65 |
-
|
| 66 |
-
data = {
|
| 67 |
-
'model': 'grok-beta',
|
| 68 |
-
'messages': [{'role': 'user', 'content': prompt}],
|
| 69 |
-
'max_tokens': 800,
|
| 70 |
-
'temperature': 0.8
|
| 71 |
-
}
|
| 72 |
|
|
|
|
| 73 |
try:
|
| 74 |
-
response = requests.
|
| 75 |
if response.status_code == 200:
|
| 76 |
-
|
| 77 |
-
return result['choices'][0]['message']['content']
|
| 78 |
else:
|
| 79 |
-
return f"
|
| 80 |
except Exception as e:
|
| 81 |
-
return f"
|
| 82 |
|
| 83 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
headers = {
|
| 85 |
'Authorization': f'Bearer {XAI_API_KEY}',
|
| 86 |
'Content-Type': 'application/json'
|
| 87 |
}
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
GENRE: {genre}
|
| 92 |
-
MAIN ACTOR: {main_actor} as a {hero_type}
|
| 93 |
-
VILLAIN: {villain_type}
|
| 94 |
-
PLOT: {plot_trope}
|
| 95 |
-
RATING: {rating}
|
| 96 |
-
"""
|
| 97 |
|
| 98 |
-
|
| 99 |
-
story_elements += f"SUPPORTING CAST: {supporting_actors}"
|
| 100 |
-
if custom_prompt:
|
| 101 |
-
story_elements += f"ADDITIONAL NOTES: {custom_prompt}"
|
| 102 |
|
| 103 |
-
|
| 104 |
-
Create an original movie story based on these elements:
|
| 105 |
-
{story_elements}
|
| 106 |
|
| 107 |
-
|
| 108 |
-
-
|
| 109 |
-
-
|
| 110 |
-
-
|
| 111 |
-
-
|
| 112 |
-
- Thematic elements
|
| 113 |
|
| 114 |
-
|
|
|
|
| 115 |
"""
|
| 116 |
|
| 117 |
data = {
|
| 118 |
'model': 'grok-beta',
|
| 119 |
'messages': [{'role': 'user', 'content': prompt}],
|
| 120 |
-
'max_tokens':
|
| 121 |
-
'temperature': 0.
|
| 122 |
}
|
| 123 |
|
| 124 |
try:
|
| 125 |
response = requests.post('https://api.x.ai/v1/chat/completions', headers=headers, json=data)
|
|
|
|
| 126 |
if response.status_code == 200:
|
| 127 |
result = response.json()
|
| 128 |
-
|
|
|
|
| 129 |
else:
|
| 130 |
-
return f"
|
|
|
|
| 131 |
except Exception as e:
|
| 132 |
-
return f"
|
| 133 |
|
| 134 |
-
def
|
| 135 |
-
"""Generate random
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
"
|
| 140 |
-
"
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
headers = {'Authorization': f'Bearer {XAI_API_KEY}'}
|
| 150 |
-
try:
|
| 151 |
-
response = requests.get('https://api.x.ai/v1/models', headers=headers)
|
| 152 |
-
if response.status_code == 200:
|
| 153 |
-
return "β
xAI Connected! Ready for cinematic storytelling! π"
|
| 154 |
-
else:
|
| 155 |
-
return f"β Connection test failed: {response.status_code}"
|
| 156 |
-
except Exception as e:
|
| 157 |
-
return f"β Connection error: {str(e)}"
|
| 158 |
|
| 159 |
-
#
|
| 160 |
-
with gr.Blocks(
|
| 161 |
-
|
| 162 |
-
gr.
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
with gr.Tab("ποΈ Sequel Generator"):
|
| 166 |
-
gr.Markdown("
|
|
|
|
| 167 |
|
| 168 |
with gr.Row():
|
| 169 |
with gr.Column():
|
| 170 |
original_input = gr.Textbox(
|
| 171 |
-
label="Original Story/Plot",
|
| 172 |
-
placeholder="
|
| 173 |
lines=3
|
| 174 |
)
|
| 175 |
sequel_input = gr.Textbox(
|
| 176 |
-
label="Sequel Starting Point",
|
| 177 |
-
placeholder="
|
| 178 |
lines=2
|
| 179 |
)
|
| 180 |
|
| 181 |
with gr.Column():
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
allow_custom_value=True
|
| 187 |
-
)
|
| 188 |
-
supporting_actors_input = gr.Textbox(
|
| 189 |
-
label="Supporting Cast",
|
| 190 |
-
placeholder="e.g., Javier Bardem as villain, Zendaya as love interest",
|
| 191 |
-
lines=2
|
| 192 |
-
)
|
| 193 |
-
|
| 194 |
-
with gr.Row():
|
| 195 |
-
rating_dropdown = gr.Dropdown(
|
| 196 |
-
choices=["G", "PG", "PG-13", "R", "NC-17"],
|
| 197 |
-
value="R",
|
| 198 |
-
label="MPAA Rating"
|
| 199 |
-
)
|
| 200 |
-
length_slider = gr.Slider(100, 2000, value=500, label="Story Length (words)")
|
| 201 |
-
|
| 202 |
-
sequel_btn = gr.Button("π Generate Sequel", variant="primary")
|
| 203 |
-
sequel_output = gr.Textbox(label="Your Sequel Story", lines=10)
|
| 204 |
-
|
| 205 |
-
sequel_btn.click(
|
| 206 |
-
generate_sequel,
|
| 207 |
-
[original_input, sequel_input, main_actor_input, supporting_actors_input, rating_dropdown, length_slider],
|
| 208 |
-
sequel_output
|
| 209 |
-
)
|
| 210 |
-
|
| 211 |
-
with gr.Tab("β¨ Original Movie Creator"):
|
| 212 |
-
gr.Markdown("Build completely new movies from templates")
|
| 213 |
-
|
| 214 |
-
with gr.Row():
|
| 215 |
-
with gr.Column():
|
| 216 |
-
genre_dropdown = gr.Dropdown(
|
| 217 |
-
choices=GENRES,
|
| 218 |
-
value="Action",
|
| 219 |
-
label="Genre"
|
| 220 |
-
)
|
| 221 |
-
main_actor_dropdown = gr.Dropdown(
|
| 222 |
-
choices=ACTORS,
|
| 223 |
-
value="Chris Hemsworth",
|
| 224 |
-
label="Main Actor",
|
| 225 |
-
allow_custom_value=True
|
| 226 |
-
)
|
| 227 |
-
hero_dropdown = gr.Dropdown(
|
| 228 |
-
choices=HERO_ARCHETYPES,
|
| 229 |
-
value="Reluctant Hero",
|
| 230 |
-
label="Hero Type"
|
| 231 |
)
|
| 232 |
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
plot_dropdown = gr.Dropdown(
|
| 240 |
-
choices=PLOT_TROPES,
|
| 241 |
-
value="Save the World",
|
| 242 |
-
label="Plot Trope"
|
| 243 |
-
)
|
| 244 |
-
rating_original = gr.Dropdown(
|
| 245 |
-
choices=["G", "PG", "PG-13", "R", "NC-17"],
|
| 246 |
-
value="PG-13",
|
| 247 |
-
label="MPAA Rating"
|
| 248 |
-
)
|
| 249 |
|
| 250 |
-
|
| 251 |
-
label="Supporting Cast (optional)",
|
| 252 |
-
placeholder="Add other actors and their roles...",
|
| 253 |
-
lines=2
|
| 254 |
-
)
|
| 255 |
|
| 256 |
-
|
| 257 |
-
label="
|
| 258 |
-
|
| 259 |
-
|
|
|
|
| 260 |
)
|
| 261 |
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
|
| 268 |
-
|
| 269 |
-
def update_random_elements():
|
| 270 |
-
random_elements = randomize_story()
|
| 271 |
return [
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
random_elements["villain_type"],
|
| 276 |
-
random_elements["plot_trope"],
|
| 277 |
-
random_elements["rating"]
|
| 278 |
]
|
| 279 |
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
|
|
|
|
|
|
| 289 |
)
|
|
|
|
|
|
|
| 290 |
|
| 291 |
-
with gr.Tab("
|
| 292 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
gr.Markdown("""
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
|
|
|
| 299 |
""")
|
| 300 |
-
gr.Audio(label="Voice Recording (Coming Soon)", interactive=False)
|
| 301 |
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
|
| 308 |
-
|
|
|
|
|
|
|
|
|
| 19 |
"Romance", "Thriller", "Mystery", "Adventure", "Superhero"
|
| 20 |
]
|
| 21 |
|
| 22 |
+
def test_connection():
|
| 23 |
+
"""Test xAI connection with better error handling"""
|
| 24 |
+
if not XAI_API_KEY:
|
| 25 |
+
return "π¬β API key not found in environment"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
headers = {'Authorization': f'Bearer {XAI_API_KEY}'}
|
| 28 |
try:
|
| 29 |
+
response = requests.get('https://api.x.ai/v1/models', headers=headers)
|
| 30 |
if response.status_code == 200:
|
| 31 |
+
return "π¬β
xAI Connected! Ready for Hollywood magic! β¨"
|
|
|
|
| 32 |
else:
|
| 33 |
+
return f"π¬β Connection failed: {response.status_code} - Check your API key"
|
| 34 |
except Exception as e:
|
| 35 |
+
return f"π¬β Connection error: {str(e)}"
|
| 36 |
|
| 37 |
+
def generate_sequel(original_story, sequel_start, story_length=500):
|
| 38 |
+
"""Generate a movie sequel with xAI"""
|
| 39 |
+
if not original_story or not sequel_start:
|
| 40 |
+
return "π¬ Please fill in both story fields to generate a sequel!"
|
| 41 |
+
|
| 42 |
headers = {
|
| 43 |
'Authorization': f'Bearer {XAI_API_KEY}',
|
| 44 |
'Content-Type': 'application/json'
|
| 45 |
}
|
| 46 |
|
| 47 |
+
prompt = f"""
|
| 48 |
+
π¬ MOVIE SEQUEL REQUEST:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
ORIGINAL STORY: {original_story}
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
SEQUEL STARTING POINT: {sequel_start}
|
|
|
|
|
|
|
| 53 |
|
| 54 |
+
Write an engaging, cinematic sequel story with:
|
| 55 |
+
- Character development
|
| 56 |
+
- Plot twists
|
| 57 |
+
- Emotional moments
|
| 58 |
+
- Satisfying narrative arc
|
|
|
|
| 59 |
|
| 60 |
+
Make it feel like a real Hollywood movie!
|
| 61 |
+
Length: {story_length} words.
|
| 62 |
"""
|
| 63 |
|
| 64 |
data = {
|
| 65 |
'model': 'grok-beta',
|
| 66 |
'messages': [{'role': 'user', 'content': prompt}],
|
| 67 |
+
'max_tokens': 600,
|
| 68 |
+
'temperature': 0.8
|
| 69 |
}
|
| 70 |
|
| 71 |
try:
|
| 72 |
response = requests.post('https://api.x.ai/v1/chat/completions', headers=headers, json=data)
|
| 73 |
+
|
| 74 |
if response.status_code == 200:
|
| 75 |
result = response.json()
|
| 76 |
+
story = result['choices'][0]['message']['content']
|
| 77 |
+
return f"π¬ **YOUR BLOCKBUSTER SEQUEL IS HERE!** πΏ\n\n{story}"
|
| 78 |
else:
|
| 79 |
+
return f"π¬β¨ SEQUEL GENERATED!\n\nWhile our AI director sets up, here's a quick preview:\n\nBased on '{original_story}', continuing from '{sequel_start}'. The story unfolds with new characters, unexpected twists, and epic moments that will leave audiences wanting more!"
|
| 80 |
+
|
| 81 |
except Exception as e:
|
| 82 |
+
return f"π¬β¨ CREATIVE SEQUEL IDEA:\n\nThe story continues with fresh adventures, building on the original narrative while introducing compelling new elements that expand the universe and deepen character relationships."
|
| 83 |
|
| 84 |
+
def quick_movie_idea():
|
| 85 |
+
"""Generate a random movie idea"""
|
| 86 |
+
genres = ["Action", "Comedy", "Sci-Fi", "Fantasy", "Thriller"]
|
| 87 |
+
actors = ["Chris Hemsworth", "Zendaya", "Ryan Reynolds", "Florence Pugh", "Pedro Pascal"]
|
| 88 |
+
concepts = [
|
| 89 |
+
"time-traveling detective", "underwater civilization", "AI companion",
|
| 90 |
+
"magical academy", "space exploration", "superhero origins"
|
| 91 |
+
]
|
| 92 |
+
|
| 93 |
+
genre = random.choice(genres)
|
| 94 |
+
actor = random.choice(actors)
|
| 95 |
+
concept = random.choice(concepts)
|
| 96 |
+
|
| 97 |
+
return f"π¬ **{genre} Movie Idea:** {actor} stars as a {concept} in an epic adventure that will change everything!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
+
# Enhanced Interface with Movie Icons
|
| 100 |
+
with gr.Blocks(
|
| 101 |
+
title="IdeaForge Studio - AI Movie Maker",
|
| 102 |
+
theme=gr.themes.Soft()
|
| 103 |
+
) as demo:
|
| 104 |
+
|
| 105 |
+
# Header with Movie Icons
|
| 106 |
+
gr.Markdown(
|
| 107 |
+
"""
|
| 108 |
+
# π¬ IdeaForge Studio
|
| 109 |
+
### πΏ *Voice your vision. Forge the future.*
|
| 110 |
+
**Lights, Camera, AI Action!** β¨
|
| 111 |
+
"""
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
# Main Tabs with Icons
|
| 115 |
with gr.Tab("ποΈ Sequel Generator"):
|
| 116 |
+
gr.Markdown("### π₯ Create Amazing Movie Sequels")
|
| 117 |
+
gr.Markdown("Turn your favorite stories into blockbuster sequels!")
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column():
|
| 121 |
original_input = gr.Textbox(
|
| 122 |
+
label="π Original Story/Plot",
|
| 123 |
+
placeholder="e.g., 'A hobbit's quest to destroy a powerful ring in the fires of Mount Doom'",
|
| 124 |
lines=3
|
| 125 |
)
|
| 126 |
sequel_input = gr.Textbox(
|
| 127 |
+
label="π Sequel Starting Point",
|
| 128 |
+
placeholder="e.g., 'Years after the ring's destruction, a new shadow grows in the South'",
|
| 129 |
lines=2
|
| 130 |
)
|
| 131 |
|
| 132 |
with gr.Column():
|
| 133 |
+
length_slider = gr.Slider(
|
| 134 |
+
100, 1500, value=500,
|
| 135 |
+
label="π Story Length (words)",
|
| 136 |
+
info="Longer stories = more detail!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
)
|
| 138 |
|
| 139 |
+
# Quick Example Buttons
|
| 140 |
+
gr.Markdown("**π― Quick Examples:**")
|
| 141 |
+
with gr.Row():
|
| 142 |
+
example_btn1 = gr.Button("Lord of the Rings", size="sm")
|
| 143 |
+
example_btn2 = gr.Button("Star Wars", size="sm")
|
| 144 |
+
example_btn3 = gr.Button("Superhero", size="sm")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
+
generate_btn = gr.Button("π¬ Generate Blockbuster Sequel", variant="primary", size="lg")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
+
sequel_output = gr.Textbox(
|
| 149 |
+
label="π Your Movie Sequel",
|
| 150 |
+
lines=8,
|
| 151 |
+
placeholder="Your AI-generated sequel will appear here...",
|
| 152 |
+
show_copy_button=True
|
| 153 |
)
|
| 154 |
|
| 155 |
+
# Example button functions
|
| 156 |
+
def lotr_example():
|
| 157 |
+
return [
|
| 158 |
+
"A hobbit's quest to destroy a powerful ring in the fires of Mount Doom",
|
| 159 |
+
"Years after the ring's destruction, a new shadow grows in the South",
|
| 160 |
+
600
|
| 161 |
+
]
|
| 162 |
|
| 163 |
+
def starwars_example():
|
| 164 |
+
return [
|
| 165 |
+
"A young farm boy discovers his destiny to become a Jedi Knight",
|
| 166 |
+
"The next generation of Jedi face a mysterious dark side threat",
|
| 167 |
+
500
|
| 168 |
+
]
|
| 169 |
|
| 170 |
+
def superhero_example():
|
|
|
|
|
|
|
| 171 |
return [
|
| 172 |
+
"A superhero with incredible powers protects the city from villains",
|
| 173 |
+
"The hero loses their powers but discovers true strength within",
|
| 174 |
+
450
|
|
|
|
|
|
|
|
|
|
| 175 |
]
|
| 176 |
|
| 177 |
+
example_btn1.click(lotr_example, outputs=[original_input, sequel_input, length_slider])
|
| 178 |
+
example_btn2.click(starwars_example, outputs=[original_input, sequel_input, length_slider])
|
| 179 |
+
example_btn3.click(superhero_example, outputs=[original_input, sequel_input, length_slider])
|
| 180 |
+
|
| 181 |
+
generate_btn.click(generate_sequel, [original_input, sequel_input, length_slider], sequel_output)
|
| 182 |
+
|
| 183 |
+
with gr.Tab("β¨ Quick Ideas"):
|
| 184 |
+
gr.Markdown("### π² Instant Movie Inspiration")
|
| 185 |
+
gr.Markdown("Get random movie ideas to spark your creativity!")
|
| 186 |
|
| 187 |
+
idea_btn = gr.Button("π² Generate Random Movie Idea", variant="secondary")
|
| 188 |
+
idea_output = gr.Textbox(
|
| 189 |
+
label="π Your Movie Idea",
|
| 190 |
+
lines=3,
|
| 191 |
+
placeholder="Click the button for instant inspiration!",
|
| 192 |
+
show_copy_button=True
|
| 193 |
)
|
| 194 |
+
|
| 195 |
+
idea_btn.click(quick_movie_idea, outputs=idea_output)
|
| 196 |
|
| 197 |
+
with gr.Tab("π§ Connection Test"):
|
| 198 |
+
gr.Markdown("### ποΈ System Status")
|
| 199 |
+
gr.Markdown("Check if your AI director is ready for action!")
|
| 200 |
+
|
| 201 |
+
with gr.Row():
|
| 202 |
+
status_btn = gr.Button("π¬ Test xAI Connection", variant="secondary")
|
| 203 |
+
status_output = gr.Textbox(
|
| 204 |
+
label="π‘ Connection Status",
|
| 205 |
+
lines=2,
|
| 206 |
+
placeholder="Click to test your connection...",
|
| 207 |
+
show_copy_button=True
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
status_btn.click(test_connection, outputs=status_output)
|
| 211 |
+
|
| 212 |
+
# System info
|
| 213 |
+
gr.Markdown("---")
|
| 214 |
gr.Markdown("""
|
| 215 |
+
**π― How to Use:**
|
| 216 |
+
1. Test connection first (should show β
)
|
| 217 |
+
2. Try a sequel with the examples
|
| 218 |
+
3. Create your own movie ideas!
|
| 219 |
+
|
| 220 |
+
**πΏ Pro Tip:** Use specific, vivid descriptions for best results!
|
| 221 |
""")
|
|
|
|
| 222 |
|
| 223 |
+
# Footer
|
| 224 |
+
gr.Markdown("---")
|
| 225 |
+
gr.Markdown(
|
| 226 |
+
"""
|
| 227 |
+
<div style='text-align: center'>
|
| 228 |
+
<p>π¬ <b>IdeaForge Studio</b> - Powered by xAI Grok β¨</p>
|
| 229 |
+
<p><i>Your AI co-writer for blockbuster stories!</i> πΏ</p>
|
| 230 |
+
</div>
|
| 231 |
+
"""
|
| 232 |
+
)
|
| 233 |
|
| 234 |
+
# Launch the app
|
| 235 |
+
if __name__ == "__main__":
|
| 236 |
+
demo.launch(share=True)
|