initial app
Browse files- .gitignore +2 -0
- app.py +34 -0
- registries/gemini-gradio.md +15 -0
- requirements.txt +1 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
__pycache__/*
|
2 |
+
.env
|
app.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
def get_markdown(registry):
|
5 |
+
with open(registry,"r") as f:
|
6 |
+
return f.read()
|
7 |
+
|
8 |
+
def get_interface(md):
|
9 |
+
code = "import" + md.split("import")[2].split(".launch")[0]
|
10 |
+
return code
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
# need to match the filenames in the regesteries folder
|
16 |
+
possible_registries = ["gemini-gradio"]
|
17 |
+
|
18 |
+
with gr.Blocks() as demo :
|
19 |
+
gr.Markdown("<h1 style='text-align: center;'>Gradio registry</h1>")
|
20 |
+
dropdown = gr.Dropdown(possible_registries,value=possible_registries[0],interactive=True)
|
21 |
+
|
22 |
+
@gr.render(inputs=dropdown)
|
23 |
+
def create_interface(registry):
|
24 |
+
filepath = f"registries/{registry}.md"
|
25 |
+
md = get_markdown(filepath)
|
26 |
+
gr.Markdown(md)
|
27 |
+
# try :
|
28 |
+
# code = get_interface(md)
|
29 |
+
# exec(code)
|
30 |
+
# except Exception as e :
|
31 |
+
# raise gr.Error(e)
|
32 |
+
|
33 |
+
|
34 |
+
demo.launch()
|
registries/gemini-gradio.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## gemini-gradio
|
2 |
+
|
3 |
+
```
|
4 |
+
pip install gemini-gradio
|
5 |
+
```
|
6 |
+
|
7 |
+
```python
|
8 |
+
import gradio as gr
|
9 |
+
import gemini_gradio
|
10 |
+
|
11 |
+
gr.load(
|
12 |
+
name='gemini-exp-1206',
|
13 |
+
src=gemini_gradio.registry,
|
14 |
+
).launch()
|
15 |
+
```
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gemini-gradio
|