Patrik Stano commited on
Commit
b761cf7
·
1 Parent(s): 38ca6ac

Update generation parameters

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -2,14 +2,18 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  # Load the Hugging Face model
5
- # Replace 'your-username/your-model-name' with the actual path to your Hugging Face model
6
  model_path = "patrixtano/mt5-small-anaphora_czech_6e"
7
  model_pipeline = pipeline("text2text-generation", model=model_path)
8
-
9
  def predict(text_input):
10
  """
11
  Generate a prediction for the given input text using the Hugging Face model.
12
  """
 
 
 
 
 
13
  try:
14
  result = model_pipeline(text_input)
15
  # Extract and return the generated text
 
2
  from transformers import pipeline
3
 
4
  # Load the Hugging Face model
 
5
  model_path = "patrixtano/mt5-small-anaphora_czech_6e"
6
  model_pipeline = pipeline("text2text-generation", model=model_path)
7
+ tokenizer = AutoTokenizer.from_pretrained("patrixtano/mt5-small-anaphora_czech_3e")
8
  def predict(text_input):
9
  """
10
  Generate a prediction for the given input text using the Hugging Face model.
11
  """
12
+ input_length = len(tokenizer(input_text)["input_ids"])
13
+ generation_parameters = {
14
+ "min_length": input_length + 5, # Set your desired minimum length
15
+ "max_length": input_length + 10 # Set your desired maximum length
16
+ }
17
  try:
18
  result = model_pipeline(text_input)
19
  # Extract and return the generated text