Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import plotly.express as px
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# Generate a simple plotly graph (e.g., a sine wave)
|
| 6 |
+
def generate_graph():
|
| 7 |
+
x = np.linspace(0, 2 * np.pi, 100)
|
| 8 |
+
y = np.sin(x)
|
| 9 |
+
fig = px.line(x=x, y=y, title="Sine Wave")
|
| 10 |
+
return fig
|
| 11 |
+
|
| 12 |
+
# Path to a video file (you can replace this with your own video file)
|
| 13 |
+
video_path = "sample.mp4"
|
| 14 |
+
|
| 15 |
+
# Create a Gradio interface with both a graph and a video displayed side by side
|
| 16 |
+
with gr.Blocks() as demo:
|
| 17 |
+
with gr.Row():
|
| 18 |
+
graph = gr.Plot(generate_graph(), label="Graph")
|
| 19 |
+
video = gr.Video(video_path, label="Sample Video")
|
| 20 |
+
|
| 21 |
+
demo.launch()
|