alpha1ct commited on
Commit
26ddb6e
·
verified ·
1 Parent(s): f26d5e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -17
app.py CHANGED
@@ -1,27 +1,15 @@
1
  import gradio as gr
2
- import os
3
 
4
- # Function to read the content of index.html
5
- def get_index_html():
6
- file_path = os.path.join(os.path.dirname(__file__), "index.html")
7
- with open(file_path, "r") as f:
8
- return f.read()
9
-
10
- # Embed the HTML content directly in the Gradio app
11
  def embed_html():
12
- html_content = get_index_html()
13
- return f"<div style='height: 600px;'>{html_content}</div>"
 
14
 
15
- # Create the Gradio interface with tabs
16
  with gr.Blocks() as app:
17
- with gr.Tab("Index HTML Tab"):
18
- gr.HTML(embed_html()) # Use gr.HTML to display the HTML content
19
 
20
  with gr.Tab("Second Tab"):
21
  gr.Textbox(value="Content for the second tab", label="Second Tab Content")
22
 
23
- with gr.Tab("Third Tab"):
24
- gr.Textbox(value="Content for the third tab", label="Third Tab Content")
25
-
26
- # Launch the Gradio app
27
  app.launch()
 
1
  import gradio as gr
 
2
 
 
 
 
 
 
 
 
3
  def embed_html():
4
+ return """
5
+ <iframe src='https://en.wikipedia.org/wiki/Chocolate' width='100%' height='600' allow='fullscreen'></iframe>
6
+ """
7
 
 
8
  with gr.Blocks() as app:
9
+ with gr.Tab("Wikipedia Tab"):
10
+ gr.HTML(embed_html())
11
 
12
  with gr.Tab("Second Tab"):
13
  gr.Textbox(value="Content for the second tab", label="Second Tab Content")
14
 
 
 
 
 
15
  app.launch()