Spaces:
Runtime error
Runtime error
Commit
·
5f92ddc
1
Parent(s):
83c4c0e
testing custom js and css
Browse files
app.py
CHANGED
@@ -1,31 +1,32 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
# Define a function that echoes the input text
|
4 |
def echo_text(input_text):
|
5 |
return input_text
|
6 |
|
|
|
7 |
custom_css = """
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
18 |
"""
|
19 |
|
20 |
iface = gr.Interface(
|
21 |
fn=echo_text,
|
22 |
-
inputs=gr.Textbox(text="Enter text here...", style=custom_css),
|
23 |
-
outputs=gr.Textbox(style=custom_css),
|
24 |
-
live=True
|
25 |
-
title="LLM Evaluator with Linguistic Scrutiny",
|
26 |
-
width=500,
|
27 |
-
height=200,
|
28 |
-
theme="dark" # You can use "dark" for a dark theme
|
29 |
)
|
30 |
|
31 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
def echo_text(input_text):
|
4 |
return input_text
|
5 |
|
6 |
+
# Custom CSS
|
7 |
custom_css = """
|
8 |
+
#custom-textbox {
|
9 |
+
background-color: #f2f2f2;
|
10 |
+
color: #333;
|
11 |
+
font-size: 16px;
|
12 |
+
border: 2px solid #666;
|
13 |
+
padding: 10px;
|
14 |
+
}
|
15 |
+
"""
|
16 |
+
|
17 |
+
# Custom JavaScript
|
18 |
+
custom_js = """
|
19 |
+
document.getElementById("custom-textbox").addEventListener("input", function() {
|
20 |
+
var inputValue = this.value;
|
21 |
+
document.getElementById("output-text").value = inputValue;
|
22 |
+
});
|
23 |
"""
|
24 |
|
25 |
iface = gr.Interface(
|
26 |
fn=echo_text,
|
27 |
+
inputs=gr.Textbox(id="custom-textbox", text="Enter text here...", style=custom_css, _js=custom_js), # Use custom CSS and JavaScript
|
28 |
+
outputs=gr.Textbox(id="output-text", style=custom_css),
|
29 |
+
live=True
|
|
|
|
|
|
|
|
|
30 |
)
|
31 |
|
32 |
+
iface.launch()
|