Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,52 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
from inference.main import MultiModalPhi2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
messages = []
|
| 6 |
|
|
@@ -60,18 +106,15 @@ def run(history, text, image, audio_upload, audio_mic):
|
|
| 60 |
return history, None, None, None, None
|
| 61 |
|
| 62 |
|
| 63 |
-
with gr.Blocks() as demo:
|
| 64 |
gr.Markdown("## MulitModal Phi2 Model Pretraining and Finetuning from Scratch")
|
| 65 |
|
| 66 |
-
# with gr.Column(scale=8):
|
| 67 |
-
# with gr.Box():
|
| 68 |
with gr.Row():
|
| 69 |
chatbot = gr.Chatbot(
|
| 70 |
avatar_images=("🧑", "🤖"),
|
| 71 |
height=450,
|
| 72 |
)
|
| 73 |
|
| 74 |
-
# with gr.Box():
|
| 75 |
with gr.Row():
|
| 76 |
# Adding a Textbox with a placeholder "write prompt"
|
| 77 |
prompt = gr.Textbox(
|
|
@@ -88,7 +131,7 @@ with gr.Blocks() as demo:
|
|
| 88 |
)
|
| 89 |
with gr.Row():
|
| 90 |
# Adding a Button
|
| 91 |
-
submit = gr.Button()
|
| 92 |
clear = gr.Button(value="Clear")
|
| 93 |
|
| 94 |
submit.click(
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
from inference.main import MultiModalPhi2
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
from typing import Iterable
|
| 6 |
+
import gradio as gr
|
| 7 |
+
from gradio.themes.base import Base
|
| 8 |
+
from gradio.themes.utils import colors, fonts, sizes
|
| 9 |
+
import time
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Seafoam(Base):
|
| 13 |
+
def __init__(
|
| 14 |
+
self,
|
| 15 |
+
*,
|
| 16 |
+
primary_hue: colors.Color | str = colors.emerald,
|
| 17 |
+
secondary_hue: colors.Color | str = colors.blue,
|
| 18 |
+
neutral_hue: colors.Color | str = colors.gray,
|
| 19 |
+
spacing_size: sizes.Size | str = sizes.spacing_md,
|
| 20 |
+
radius_size: sizes.Size | str = sizes.radius_md,
|
| 21 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
| 22 |
+
font: fonts.Font
|
| 23 |
+
| str
|
| 24 |
+
| Iterable[fonts.Font | str] = (
|
| 25 |
+
fonts.GoogleFont("Quicksand"),
|
| 26 |
+
"ui-sans-serif",
|
| 27 |
+
"sans-serif",
|
| 28 |
+
),
|
| 29 |
+
font_mono: fonts.Font
|
| 30 |
+
| str
|
| 31 |
+
| Iterable[fonts.Font | str] = (
|
| 32 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
| 33 |
+
"ui-monospace",
|
| 34 |
+
"monospace",
|
| 35 |
+
),
|
| 36 |
+
):
|
| 37 |
+
super().__init__(
|
| 38 |
+
primary_hue=primary_hue,
|
| 39 |
+
secondary_hue=secondary_hue,
|
| 40 |
+
neutral_hue=neutral_hue,
|
| 41 |
+
spacing_size=spacing_size,
|
| 42 |
+
radius_size=radius_size,
|
| 43 |
+
text_size=text_size,
|
| 44 |
+
font=font,
|
| 45 |
+
font_mono=font_mono,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
seafoam = Seafoam()
|
| 50 |
|
| 51 |
messages = []
|
| 52 |
|
|
|
|
| 106 |
return history, None, None, None, None
|
| 107 |
|
| 108 |
|
| 109 |
+
with gr.Blocks(theme=seafoam) as demo:
|
| 110 |
gr.Markdown("## MulitModal Phi2 Model Pretraining and Finetuning from Scratch")
|
| 111 |
|
|
|
|
|
|
|
| 112 |
with gr.Row():
|
| 113 |
chatbot = gr.Chatbot(
|
| 114 |
avatar_images=("🧑", "🤖"),
|
| 115 |
height=450,
|
| 116 |
)
|
| 117 |
|
|
|
|
| 118 |
with gr.Row():
|
| 119 |
# Adding a Textbox with a placeholder "write prompt"
|
| 120 |
prompt = gr.Textbox(
|
|
|
|
| 131 |
)
|
| 132 |
with gr.Row():
|
| 133 |
# Adding a Button
|
| 134 |
+
submit = gr.Button(value = "Submit")
|
| 135 |
clear = gr.Button(value="Clear")
|
| 136 |
|
| 137 |
submit.click(
|