alan5543 commited on
Commit
d683a81
·
1 Parent(s): 9d7c4d1
Files changed (1) hide show
  1. app.py +42 -29
app.py CHANGED
@@ -74,38 +74,51 @@ def clean_tweet(tweet):
74
 
75
  return cleaned_tweet.strip()
76
 
77
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  # Add a title with the X.com logo
79
- with gr.Column(align="center"):
80
- gr.Markdown(
81
- """
82
- <div style="text-align: center;">
83
- <img src="https://upload.wikimedia.org/wikipedia/commons/b/b7/X_logo.jpg"
84
- alt="X.com Logo" width="100">
85
- <h1 style="font-size: 2.5em; margin: 0;">Tweet Generator</h1>
86
- <p style="font-size: 1.2em; color: gray;">
87
- Powered by <b>AlanYky/phi-3.5_tweets_instruct</b>
88
- </p>
89
- </div>
90
- """,
91
- elem_id="header"
92
- )
93
 
94
  # Center the input and output components
95
- with gr.Column(align="center"):
96
- instruction_input = gr.Textbox(
97
- label="Tweet Idea",
98
- placeholder="Enter your tweet idea (It can be a topic, hashtag, sentence, or any format)...",
99
- lines=2,
100
- elem_id="input-box"
101
- )
102
- generate_button = gr.Button("Generate", elem_id="generate-button")
103
- output_box = gr.Textbox(
104
- label="Generated Tweet",
105
- placeholder="Your tweet will appear here.",
106
- lines=3,
107
- elem_id="output-box"
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)