ANASAKHTAR commited on
Commit
d3f8b50
·
verified ·
1 Parent(s): e3b75a7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from app.ai_generator import generate_content
3
+ from app.seo_optimizer import optimize_content
4
+
5
+ def generate_and_optimize_content(topic: str):
6
+ # Generate content using Hugging Face model
7
+ generated_content = generate_content(topic)
8
+
9
+ # Optimize the content for SEO
10
+ optimized_content = optimize_content(generated_content)
11
+
12
+ # Return the optimized content and SEO details
13
+ return optimized_content["content"], optimized_content["metadata"]["title"], optimized_content["metadata"]["description"]
14
+
15
+ # Gradio Interface
16
+ iface = gr.Interface(
17
+ fn=generate_and_optimize_content, # Function to call
18
+ inputs=[gr.Textbox(label="Enter Topic", placeholder="Enter YouTube topic here...")], # User input
19
+ outputs=[
20
+ gr.Textbox(label="Generated Content"), # Generated content
21
+ gr.Textbox(label="SEO Title"), # SEO optimized title
22
+ gr.Textbox(label="SEO Description") # SEO optimized description
23
+ ],
24
+ live=True, # Enable live mode for real-time output
25
+ title="YouTube AI Content Generator", # App title
26
+ description="Generate SEO-optimized YouTube content on any topic using AI."
27
+ )
28
+
29
+ # Launch the interface
30
+ iface.launch()