TuringsSolutions commited on
Commit
79acb4d
·
verified ·
1 Parent(s): 94f7c96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -63,7 +63,12 @@ def generate_tasks_from_model(api_url, num_tasks):
63
  outputs = model.generate(**inputs, max_length=50) # Limit max length for speed
64
  task = tokenizer.decode(outputs[0], skip_special_tokens=True)
65
  print(f"Generated task: {task}")
66
- tasks.append(task)
 
 
 
 
 
67
  except Exception as e:
68
  print(f"Error generating task: {str(e)}")
69
  tasks.append(f"Error generating task: {str(e)}")
@@ -125,4 +130,4 @@ iface = gr.Interface(
125
  """
126
  )
127
 
128
- iface.launch()
 
63
  outputs = model.generate(**inputs, max_length=50) # Limit max length for speed
64
  task = tokenizer.decode(outputs[0], skip_special_tokens=True)
65
  print(f"Generated task: {task}")
66
+ # Check if the generated task is a valid URL
67
+ if task.startswith("http://") or task.startswith("https://"):
68
+ tasks.append(task)
69
+ else:
70
+ print(f"Invalid task generated: {task}")
71
+ tasks.append(f"Error: Invalid task generated: {task}")
72
  except Exception as e:
73
  print(f"Error generating task: {str(e)}")
74
  tasks.append(f"Error generating task: {str(e)}")
 
130
  """
131
  )
132
 
133
+ iface.launch()