Navyabhat commited on
Commit
bd0b898
·
verified ·
1 Parent(s): 1d40a08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -17
app.py CHANGED
@@ -61,41 +61,85 @@ def run(history, text, image, audio_upload, audio_mic):
61
  return history, None, None, None, None
62
 
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  with gr.Blocks() as demo:
65
- gr.Markdown("## MulitModal Phi2 Model Pretraining and Finetuning from Scratch")
66
-
67
  with gr.Row():
68
  with gr.Column(scale=4):
69
- # Creating a column with a scale of 6
70
- with gr.Box():
71
  with gr.Row():
72
- # Adding a Textbox with a placeholder "write prompt"
73
  prompt = gr.Textbox(
74
- placeholder="Enter Prompt", lines=2, label="Query", value=None
 
 
 
 
75
  )
76
- # Creating a column with a scale of 2
77
  with gr.Row():
78
- # Adding image
79
- image = gr.Image(type="filepath", value=None)
80
- # Creating a column with a scale of 2
81
  with gr.Row():
82
- # Add audio
83
- audio_upload = gr.Audio(source="upload", type="filepath")
 
84
  audio_mic = gr.Audio(
85
- source="microphone", type="filepath", format="mp3"
 
 
 
86
  )
87
 
88
  with gr.Column(scale=8):
89
- with gr.Box():
90
  with gr.Row():
91
  chatbot = gr.Chatbot(
92
  avatar_images=("🧑", "🤖"),
93
  height=550,
 
94
  )
95
  with gr.Row():
96
- # Adding a Button
97
- submit = gr.Button()
98
- clear = gr.Button(value="Clear")
99
 
100
  submit.click(
101
  add_content,
 
61
  return history, None, None, None, None
62
 
63
 
64
+ # Custom styling
65
+ interface_style = {
66
+ "box": {
67
+ "backgroundColor": "#f9f9f9",
68
+ "padding": "20px",
69
+ "borderRadius": "10px",
70
+ "boxShadow": "0 0 10px rgba(0, 0, 0, 0.1)",
71
+ },
72
+ "button": {
73
+ "backgroundColor": "#4caf50",
74
+ "color": "#fff",
75
+ "padding": "10px",
76
+ "border": "none",
77
+ "borderRadius": "5px",
78
+ "cursor": "pointer",
79
+ },
80
+ "textbox": {
81
+ "width": "100%",
82
+ "padding": "10px",
83
+ "marginBottom": "10px",
84
+ "boxSizing": "border-box",
85
+ },
86
+ "image": {
87
+ "width": "100%",
88
+ "marginBottom": "10px",
89
+ },
90
+ "audio": {
91
+ "width": "100%",
92
+ "marginBottom": "10px",
93
+ },
94
+ "chatbox": {
95
+ "height": "550px",
96
+ "backgroundColor": "#f0f0f0",
97
+ "borderRadius": "5px",
98
+ "padding": "10px",
99
+ "overflowY": "auto",
100
+ },
101
+ }
102
+
103
  with gr.Blocks() as demo:
104
+ gr.Markdown("## MultiModal Phi2 Model Pretraining and Finetuning from Scratch")
105
+
106
  with gr.Row():
107
  with gr.Column(scale=4):
108
+ with gr.Box(style=interface_style["box"]):
 
109
  with gr.Row():
 
110
  prompt = gr.Textbox(
111
+ placeholder="Enter Prompt",
112
+ lines=2,
113
+ label="Query",
114
+ value=None,
115
+ style=interface_style["textbox"],
116
  )
 
117
  with gr.Row():
118
+ image = gr.Image(
119
+ type="filepath", value=None, style=interface_style["image"]
120
+ )
121
  with gr.Row():
122
+ audio_upload = gr.Audio(
123
+ source="upload", type="filepath", style=interface_style["audio"]
124
+ )
125
  audio_mic = gr.Audio(
126
+ source="microphone",
127
+ type="filepath",
128
+ format="mp3",
129
+ style=interface_style["audio"],
130
  )
131
 
132
  with gr.Column(scale=8):
133
+ with gr.Box(style=interface_style["box"]):
134
  with gr.Row():
135
  chatbot = gr.Chatbot(
136
  avatar_images=("🧑", "🤖"),
137
  height=550,
138
+ style=interface_style["chatbox"],
139
  )
140
  with gr.Row():
141
+ submit = gr.Button(style=interface_style["button"])
142
+ clear = gr.Button(value="Clear", style=interface_style["button"])
 
143
 
144
  submit.click(
145
  add_content,