Spaces:
Runtime error
Runtime error
alan5543
commited on
Commit
·
d683a81
1
Parent(s):
9d7c4d1
update UI
Browse files
app.py
CHANGED
@@ -74,38 +74,51 @@ def clean_tweet(tweet):
|
|
74 |
|
75 |
return cleaned_tweet.strip()
|
76 |
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
# Add a title with the X.com logo
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
<
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
elem_id="header"
|
92 |
-
)
|
93 |
|
94 |
# Center the input and output components
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
)
|
109 |
|
110 |
# Connect the button to the generate function
|
111 |
generate_button.click(generate_tweet, inputs=instruction_input, outputs=output_box)
|
|
|
74 |
|
75 |
return cleaned_tweet.strip()
|
76 |
|
77 |
+
custom_css = """
|
78 |
+
#header {
|
79 |
+
text-align: center;
|
80 |
+
margin-top: 20px;
|
81 |
+
}
|
82 |
+
#input-box, #output-box {
|
83 |
+
margin: 0 auto;
|
84 |
+
width: 80%;
|
85 |
+
}
|
86 |
+
#generate-button {
|
87 |
+
margin: 10px auto;
|
88 |
+
display: block;
|
89 |
+
}
|
90 |
+
"""
|
91 |
+
|
92 |
+
|
93 |
+
with gr.Blocks(css=custom_css) as demo:
|
94 |
# Add a title with the X.com logo
|
95 |
+
gr.Markdown(
|
96 |
+
"""
|
97 |
+
<div id="header">
|
98 |
+
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/X.com_logo.svg/1024px-X.com_logo.svg.png"
|
99 |
+
alt="X.com Logo" width="100">
|
100 |
+
<h1 style="font-size: 2.5em; margin: 0;">Tweet Generator</h1>
|
101 |
+
<p style="font-size: 1.2em; color: gray;">
|
102 |
+
Powered by <b>AlanYky/phi-3.5_tweets_instruct</b>
|
103 |
+
</p>
|
104 |
+
</div>
|
105 |
+
"""
|
106 |
+
)
|
|
|
|
|
107 |
|
108 |
# Center the input and output components
|
109 |
+
instruction_input = gr.Textbox(
|
110 |
+
label="Tweet Idea",
|
111 |
+
placeholder="Enter your tweet idea (It can be a topic, hashtag, sentence, or any format)...",
|
112 |
+
lines=2,
|
113 |
+
elem_id="input-box"
|
114 |
+
)
|
115 |
+
generate_button = gr.Button("Generate", elem_id="generate-button")
|
116 |
+
output_box = gr.Textbox(
|
117 |
+
label="Generated Tweet",
|
118 |
+
placeholder="Your tweet will appear here.",
|
119 |
+
lines=3,
|
120 |
+
elem_id="output-box"
|
121 |
+
)
|
|
|
122 |
|
123 |
# Connect the button to the generate function
|
124 |
generate_button.click(generate_tweet, inputs=instruction_input, outputs=output_box)
|