Spaces:
Sleeping
Sleeping
Pooja P
commited on
Commit
Β·
225a7e5
1
Parent(s):
d2e9f68
used transformer instead of openai
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
from transformers import pipeline
|
31 |
import gradio as gr
|
32 |
|
33 |
-
generator = pipeline("text-generation", model="
|
34 |
|
35 |
def clean_topic(topic):
|
36 |
topic = topic.lower()
|
@@ -40,10 +40,19 @@ def clean_topic(topic):
|
|
40 |
topic = topic.replace("write a blog about", "").strip()
|
41 |
return topic.capitalize()
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
def generate_blog(topic):
|
44 |
-
topic = clean_topic(topic)
|
45 |
-
if not topic:
|
46 |
-
return "Please provide a topic."
|
47 |
prompt = f"""
|
48 |
Write a detailed and engaging blog post about "{topic}".
|
49 |
Include an introduction, 2β3 subheadings with paragraphs, and a conclusion.
|
|
|
30 |
from transformers import pipeline
|
31 |
import gradio as gr
|
32 |
|
33 |
+
generator = pipeline("text-generation", model="tiiuae/falcon-7b-instruct")
|
34 |
|
35 |
def clean_topic(topic):
|
36 |
topic = topic.lower()
|
|
|
40 |
topic = topic.replace("write a blog about", "").strip()
|
41 |
return topic.capitalize()
|
42 |
|
43 |
+
# def generate_blog(topic):
|
44 |
+
# topic = clean_topic(topic)
|
45 |
+
# if not topic:
|
46 |
+
# return "Please provide a topic."
|
47 |
+
# prompt = f"""
|
48 |
+
# Write a detailed and engaging blog post about "{topic}".
|
49 |
+
# Include an introduction, 2β3 subheadings with paragraphs, and a conclusion.
|
50 |
+
# Make it informative and conversational.
|
51 |
+
# """
|
52 |
+
# result = generator(prompt, max_length=700, do_sample=True, temperature=0.7, top_p=0.9)
|
53 |
+
# return result[0]['generated_text']
|
54 |
+
|
55 |
def generate_blog(topic):
|
|
|
|
|
|
|
56 |
prompt = f"""
|
57 |
Write a detailed and engaging blog post about "{topic}".
|
58 |
Include an introduction, 2β3 subheadings with paragraphs, and a conclusion.
|