lingadevaruhp commited on
Commit
97aef11
·
verified ·
1 Parent(s): 8dffb64

Update app.py: Enhanced Gradio textboxes with lines=10 for AI response, lines=4 for input, show_copy_button=True and show_clear_button=True

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -49,9 +49,9 @@ def load_dataset():
49
  try:
50
  with open(dataset_file, 'r', encoding='utf-8') as f:
51
  content = f.read().strip()
52
- if content.startswith('<!DOCTYPE html>') or '<html>' in content:
53
- print(f"Skipping HTML file: {dataset_file}")
54
- continue
55
  sample_entries = [
56
  {"input": "Hello", "output": "Hi there! How are you doing today?"},
57
  {"input": "How are you?", "output": "I'm doing great! Thanks for asking. What can I help you with?"},
@@ -102,16 +102,27 @@ def generate_response(prompt, max_new_tokens=100):
102
  except Exception as e:
103
  return f"Error generating response: {str(e)}"
104
 
 
105
  iface = gr.Interface(
106
  fn=generate_response,
107
  inputs=[
108
- gr.Textbox(label="Your message", placeholder="Type your message here..."),
 
 
 
 
 
109
  gr.Slider(minimum=10, maximum=200, value=100, label="Max New Tokens")
110
  ],
111
- outputs=gr.Textbox(label="AI Response"),
 
 
 
 
 
112
  title="thoshan_Flash (Updated with JSONL Dataset)",
113
  description="Chat with AI powered by thoshan_Flash and the new flirt_dataset.jsonl dataset!"
114
  )
115
 
116
  if __name__ == "__main__":
117
- iface.launch()
 
49
  try:
50
  with open(dataset_file, 'r', encoding='utf-8') as f:
51
  content = f.read().strip()
52
+ if content.startswith('<!DOCTYPE html>') or '<html>' in content:
53
+ print(f"Skipping HTML file: {dataset_file}")
54
+ continue
55
  sample_entries = [
56
  {"input": "Hello", "output": "Hi there! How are you doing today?"},
57
  {"input": "How are you?", "output": "I'm doing great! Thanks for asking. What can I help you with?"},
 
102
  except Exception as e:
103
  return f"Error generating response: {str(e)}"
104
 
105
+ # Updated Gradio interface with enhanced textbox features
106
  iface = gr.Interface(
107
  fn=generate_response,
108
  inputs=[
109
+ gr.Textbox(
110
+ label="Your message",
111
+ placeholder="Type your message here...",
112
+ lines=4,
113
+ show_clear_button=True
114
+ ),
115
  gr.Slider(minimum=10, maximum=200, value=100, label="Max New Tokens")
116
  ],
117
+ outputs=gr.Textbox(
118
+ label="AI Response",
119
+ lines=10,
120
+ show_copy_button=True,
121
+ show_clear_button=True
122
+ ),
123
  title="thoshan_Flash (Updated with JSONL Dataset)",
124
  description="Chat with AI powered by thoshan_Flash and the new flirt_dataset.jsonl dataset!"
125
  )
126
 
127
  if __name__ == "__main__":
128
+ iface.launch()