imperialwool commited on
Commit
c17f6fc
1 Parent(s): 505fb43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -12
app.py CHANGED
@@ -122,18 +122,6 @@ def toxicityAnalys():
122
  return {"status": "pass", "toxicity": predicted_sentiment}
123
  except Exception as e: return {"status": "error", "details": { "error_code": 123, "error_details": str(e).replace("\n", " | ") }} , 400
124
 
125
- ##############
126
- # GENERATE TEXT
127
- generator = pipeline("text-generation", model="IlyaGusev/rugpt_large_turbo_instructed")
128
- @app.route('/text/api/v1/generate', methods=['POST'])
129
- def generateText():
130
- try:
131
- text = helpers.getFromRequest(request, "text")
132
- if not text: return {"status": "error", "details": { "error_code": 101, "error_details": "No text provided" }} , 400
133
- result = generator(text, min_length=512, max_length=1512, return_full_text=False, do_sample=bool(randint(0,1)), temperature=float(randint(5,15))/10.0, max_time=15)
134
- return {"status": "pass", "result": result[0]["generated_text"]}
135
- except Exception as e: return {"status": "error", "details": { "error_code": 123, "error_details": str(e).replace("\n", " | ") }} , 400
136
-
137
  ##############
138
  # INIT APP
139
  if __name__ == "__main__":
 
122
  return {"status": "pass", "toxicity": predicted_sentiment}
123
  except Exception as e: return {"status": "error", "details": { "error_code": 123, "error_details": str(e).replace("\n", " | ") }} , 400
124
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  ##############
126
  # INIT APP
127
  if __name__ == "__main__":