ranamhamoud commited on
Commit
ffb8571
โ€ข
1 Parent(s): f2e0653

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -43,15 +43,15 @@ model = PeftModel.from_pretrained(base_model, "ranamhamoud/storytell")
43
  tokenizer = AutoTokenizer.from_pretrained(model_id)
44
  tokenizer.pad_token = tokenizer.eos_token
45
 
46
- # MongoDB Connection
47
- PASSWORD = os.environ.get("MONGO_PASS")
48
- connect(host=f"mongodb+srv://ranamhammoud11:{PASSWORD}@stories.zf5v52a.mongodb.net/")
49
-
50
- # MongoDB Document
51
- class Story(Document):
52
- message = StringField()
53
- content = StringField()
54
- story_id = SequenceField(primary_key=True)
55
 
56
 
57
  # Utility function for prompts
@@ -135,8 +135,8 @@ def generate(
135
  final_story_trimmed = remove_last_sentence(final_story)
136
 
137
  try:
138
- saved_story = Story(message=message, content=final_story_trimmed).save()
139
- yield f"{final_story_trimmed}\n\n Story saved with ID: {saved_story.story_id}"
140
  except Exception as e:
141
  yield f"Failed to save story: {str(e)}"
142
 
 
43
  tokenizer = AutoTokenizer.from_pretrained(model_id)
44
  tokenizer.pad_token = tokenizer.eos_token
45
 
46
+ # # MongoDB Connection
47
+ # PASSWORD = os.environ.get("MONGO_PASS")
48
+ # connect(host=f"mongodb+srv://ranamhammoud11:{PASSWORD}@stories.zf5v52a.mongodb.net/")
49
+
50
+ # # MongoDB Document
51
+ # class Story(Document):
52
+ # message = StringField()
53
+ # content = StringField()
54
+ # story_id = SequenceField(primary_key=True)
55
 
56
 
57
  # Utility function for prompts
 
135
  final_story_trimmed = remove_last_sentence(final_story)
136
 
137
  try:
138
+ # saved_story = Story(message=message, content=final_story_trimmed).save()
139
+ yield f"{final_story_trimmed}"
140
  except Exception as e:
141
  yield f"Failed to save story: {str(e)}"
142