Spaces:
Running
Running
Update gradio_app.py
Browse files- gradio_app.py +16 -15
gradio_app.py
CHANGED
|
@@ -12,32 +12,33 @@ def respond(input_text):
|
|
| 12 |
|
| 13 |
# Step 3: Create a Gradio interface
|
| 14 |
# This interface will take text input from the user and display the chatbot's response
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
|
|
|
| 23 |
iface.launch(inline=True, share=True, css="""
|
| 24 |
body {
|
| 25 |
-
background-color: orange; /*
|
| 26 |
border:10px solid white;
|
| 27 |
}
|
| 28 |
.container {
|
| 29 |
-
max-width: 800px; /* Limit the width of the container */
|
| 30 |
margin: auto;
|
| 31 |
padding: 20px;
|
| 32 |
}
|
| 33 |
-
.
|
| 34 |
-
|
| 35 |
-
font-size: 1.2em;
|
| 36 |
-
}
|
| 37 |
-
.input_text {
|
| 38 |
-
border: 2px solid #007bff; /* Custom border for the input */
|
| 39 |
border-radius: 4px;
|
| 40 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
""")
|
| 42 |
|
| 43 |
# Step 4: Launch the interface
|
|
|
|
| 12 |
|
| 13 |
# Step 3: Create a Gradio interface
|
| 14 |
# This interface will take text input from the user and display the chatbot's response
|
| 15 |
+
iface = gr.Interface(
|
| 16 |
+
fn=respond, # The function to call when the user submits input
|
| 17 |
+
inputs="text", # The type of input (text)
|
| 18 |
+
outputs="text", # The type of output (text)
|
| 19 |
+
title="HugChat - Your AI Chatbot", # The title of your chatbot
|
| 20 |
+
description="Chat with an AI-powered bot based on a pre-trained model." # A short description
|
| 21 |
+
)
|
| 22 |
|
| 23 |
+
# Inject custom CSS
|
| 24 |
iface.launch(inline=True, share=True, css="""
|
| 25 |
body {
|
| 26 |
+
background-color: orange !important; /* Make sure this is applied */
|
| 27 |
border:10px solid white;
|
| 28 |
}
|
| 29 |
.container {
|
| 30 |
+
max-width: 800px !important; /* Limit the width of the container */
|
| 31 |
margin: auto;
|
| 32 |
padding: 20px;
|
| 33 |
}
|
| 34 |
+
.gr-input {
|
| 35 |
+
border: 2px solid #007bff !important; /* Use the correct class for Gradio input */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
border-radius: 4px;
|
| 37 |
}
|
| 38 |
+
.gr-output {
|
| 39 |
+
color: black !important; /* Ensure this is not overridden */
|
| 40 |
+
font-size: 1.2em !important;
|
| 41 |
+
}
|
| 42 |
""")
|
| 43 |
|
| 44 |
# Step 4: Launch the interface
|