Spaces:
Runtime error
Runtime error
Calvin commited on
Commit Β·
c2b1d8b
1
Parent(s): c0b6253
fix port
Browse files- app.py +12 -8
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -46,13 +46,17 @@ def generate_ui(prompt):
|
|
| 46 |
"hashtags": ["#indonesia", "#fyp"]
|
| 47 |
}
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
)
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
if __name__ == "__main__":
|
| 58 |
-
|
|
|
|
|
|
| 46 |
"hashtags": ["#indonesia", "#fyp"]
|
| 47 |
}
|
| 48 |
|
| 49 |
+
# Use gr.Blocks to enable enable_api properly
|
| 50 |
+
with gr.Blocks() as demo:
|
| 51 |
+
prompt_input = gr.Textbox(lines=6, placeholder="Masukkan prompt...")
|
| 52 |
+
output_json = gr.JSON()
|
| 53 |
+
generate_btn = gr.Button("Generate")
|
| 54 |
+
|
| 55 |
+
generate_btn.click(fn=generate_ui, inputs=prompt_input, outputs=output_json)
|
| 56 |
+
|
| 57 |
+
gr.Markdown("# TikTok Script Generator")
|
| 58 |
+
gr.Markdown("Generates short Indonesian scripts (JSON).")
|
| 59 |
|
| 60 |
if __name__ == "__main__":
|
| 61 |
+
# IMPORTANT: Use `api_open=True` instead of enable_api (since Gradio 3.40+)
|
| 62 |
+
demo.launch(server_name="0.0.0.0", port=7860, api_open=True)
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
gradio>=3.38
|
| 2 |
transformers>=4.30.0
|
| 3 |
-
torch
|
| 4 |
accelerate
|
|
|
|
| 1 |
gradio>=3.38
|
| 2 |
transformers>=4.30.0
|
| 3 |
+
torch
|
| 4 |
accelerate
|