File size: 1,300 Bytes
9819c80
b28f06f
33df8d5
 
87df5c7
6e45585
d5f1ff9
9864aa9
33df8d5
 
9819c80
6e45585
9864aa9
33df8d5
 
9819c80
6e45585
9864aa9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33df8d5
9864aa9
 
 
 
 
 
33df8d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from flask import Flask, render_template
import gradio as gr
from chatbot_ai import chatbot
from voice_ai import voice_ai

app = Flask(__name__)

# Flask Route for Home
@app.route("/")
def index():
    return render_template("index.html")

# Flask Route for Chatbot
@app.route("/chatbot")
def chatbot_page():
    return render_template("chatbot.html")

# Define Gradio Interfaces
def chatbot_interface(input_text):
    return chatbot(input_text)  # Replace with your chatbot logic

def voice_ai_interface(audio_input):
    return voice_ai(audio_input)  # Replace with your voice AI logic

# Gradio App
chatbot_gradio = gr.Interface(
    fn=chatbot_interface,
    inputs="text",
    outputs="text",
    title="Chatbot AI",
    description="Ask me anything!"
)

voice_ai_gradio = gr.Interface(
    fn=voice_ai_interface,
    inputs="audio",
    outputs="text",
    title="Voice AI",
    description="Speak and I'll transcribe."
)

# Enable Gradio Public Links
def start_gradio():
    chatbot_gradio.launch(share=True, inbrowser=True)
    voice_ai_gradio.launch(share=True, inbrowser=True)

# Main Flask Application
if __name__ == "__main__":
    import threading

    # Run Gradio in a separate thread
    threading.Thread(target=start_gradio).start()

    # Start Flask Server
    app.run(debug=True)