JaiPatel4717 commited on
Commit
0e8a501
·
verified ·
1 Parent(s): 4005d9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -27,11 +27,14 @@ if user_input:
27
 
28
  # Generate output with attention mask and pad token ID
29
  try:
30
- outputs = model.generate(input_ids, attention_mask=attention_mask, max_length=50)
31
- st.write("Model Output (Raw):", outputs) # Debugging model raw output
 
 
 
32
 
33
  # Decode the output and display
34
- answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
35
- st.write("Answer:", answer)
36
  except Exception as e:
37
- st.write("Error generating output:", str(e))
 
27
 
28
  # Generate output with attention mask and pad token ID
29
  try:
30
+ # Increased max_length to 100 for more space for generation
31
+ outputs = model.generate(input_ids, attention_mask=attention_mask, max_length=100, num_return_sequences=1)
32
+
33
+ # Debugging model raw output (just the token ids)
34
+ st.write("Model Output (Raw Token IDs):", outputs)
35
 
36
  # Decode the output and display
37
+ decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
38
+ st.write("Decoded Answer:", decoded_output)
39
  except Exception as e:
40
+ st.write("Error generating output:", str(e))