Manasa1 commited on
Commit
56d1872
·
verified ·
1 Parent(s): 40eb3f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -24
app.py CHANGED
@@ -1,36 +1,35 @@
1
- import streamlit as st
2
- import requests
3
 
4
- # Streamlit app setup
5
- st.title("Healthcare AI Avatar Chatbot")
6
- st.markdown("""
7
- This AI-powered avatar can assist with blindness treatment support and cosmetic surgery consultations.
8
- It can answer questions, guide patients, and collect necessary information securely.
9
- """)
10
 
11
- # Avatar iframe embedded
 
 
 
 
 
 
 
 
 
12
  avatar_html = """
13
- <script type="module"
 
 
14
  src="https://agent.d-id.com/v1/index.js"
15
  data-name="did-agent"
16
  data-mode="fabio"
17
- data-client-key="Z29vZ2xlLW9hdXRoMnwxMDE2MjgxNTc0MjI0MDkzMDQ0NzM6eUZROFMxSkRpV01NT2o0MThCQWFB"
18
  data-agent-id="agt_RqZwS4UC"
19
  data-monitor="true">
20
- </script>
 
21
  """
22
 
23
- st.components.v1.html(avatar_html, height=500)
24
-
25
- # Chatbot interaction
26
- st.markdown("### Ask me anything about blindness treatment or cosmetic surgery consultations!")
27
- user_input = st.text_input("Your question:")
28
-
29
- if user_input:
30
- # Call the backend FastAPI chatbot API (to be created in step 2)
31
- response = requests.post("http://localhost:8000/chat", json={"question": user_input})
32
- bot_response = response.json().get("response")
33
 
34
- # Display chatbot response
35
- st.markdown(f"**AI Avatar Response:** {bot_response}")
36
 
 
1
+ import gradio as gr
 
2
 
3
+ # Define a function for user interaction (if needed)
4
+ def get_user_input(user_input):
5
+ # Here, you can process the input if necessary
6
+ return f"You said: {user_input}"
 
 
7
 
8
+ # Create the Gradio interface
9
+ iface = gr.Interface(
10
+ fn=get_user_input,
11
+ inputs="text",
12
+ outputs="text",
13
+ title="AI Avatar with D-ID",
14
+ description="Interact with your D-ID AI Avatar."
15
+ )
16
+
17
+ # Add HTML for D-ID AI Avatar
18
  avatar_html = """
19
+ <div>
20
+ <script
21
+ type="module"
22
  src="https://agent.d-id.com/v1/index.js"
23
  data-name="did-agent"
24
  data-mode="fabio"
25
+ data-client-key="Z29vZ2dlLW9hdXRoMnwxMDE2MjgxNTc0MjI0MDkzMDQ0NzM6eUZROFMxSkRpV01NT2o0MThCQWFB"
26
  data-agent-id="agt_RqZwS4UC"
27
  data-monitor="true">
28
+ </script>
29
+ </div>
30
  """
31
 
32
+ # Launch the Gradio interface with the HTML
33
+ iface.launch(share=True, inline=True)
 
 
 
 
 
 
 
 
34
 
 
 
35