Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -138,3 +138,27 @@ Follow this example structure:
|
|
| 138 |
else:
|
| 139 |
mime_type, _ = mimetypes.guess_type(filename)
|
| 140 |
return mime_type or "application/octet-stream"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
else:
|
| 139 |
mime_type, _ = mimetypes.guess_type(filename)
|
| 140 |
return mime_type or "application/octet-stream"
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
# Re-add UI definition for Gradio
|
| 144 |
+
async def generate_interface(prompt, language, api_key, file):
|
| 145 |
+
gen = PodcastGenerator()
|
| 146 |
+
result = await gen.generate_script(prompt, language, api_key, file)
|
| 147 |
+
return json.dumps(result, indent=2)
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
interface = gr.Interface(
|
| 151 |
+
fn=generate_interface,
|
| 152 |
+
inputs=[
|
| 153 |
+
gr.Textbox(label="Prompt"),
|
| 154 |
+
gr.Radio(["English", "German", "Auto Detect"], label="Language", value="Auto Detect"),
|
| 155 |
+
gr.Textbox(label="API Key", type="password"),
|
| 156 |
+
gr.File(label="Upload File (optional)")
|
| 157 |
+
],
|
| 158 |
+
outputs=gr.Textbox(label="Generated Podcast JSON"),
|
| 159 |
+
title="Podcast Generator using Gemma",
|
| 160 |
+
description="Generate a lively podcast script from your input text or uploaded file using the tabularisai/german-gemma-3-1b-it model."
|
| 161 |
+
)
|
| 162 |
+
|
| 163 |
+
if __name__ == "__main__":
|
| 164 |
+
interface.launch()
|