Update app.py
Browse files
app.py
CHANGED
|
@@ -2,11 +2,13 @@
|
|
| 2 |
import streamlit as st
|
| 3 |
import requests
|
| 4 |
from bs4 import BeautifulSoup
|
| 5 |
-
|
| 6 |
|
| 7 |
-
# Set your Groq API key and
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def extract_text_from_url(url):
|
| 12 |
try:
|
|
@@ -29,7 +31,7 @@ Content:
|
|
| 29 |
|
| 30 |
Write the new blog post:
|
| 31 |
"""
|
| 32 |
-
response =
|
| 33 |
model="llama3-70b-8192", # LLaMA 3 via Groq
|
| 34 |
messages=[
|
| 35 |
{"role": "system", "content": "You are an expert SEO content writer."},
|
|
@@ -38,7 +40,7 @@ Write the new blog post:
|
|
| 38 |
temperature=0.7,
|
| 39 |
max_tokens=1500
|
| 40 |
)
|
| 41 |
-
return response
|
| 42 |
|
| 43 |
def main():
|
| 44 |
st.title("📝 Pro SEO Blog Writer")
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
import requests
|
| 4 |
from bs4 import BeautifulSoup
|
| 5 |
+
from openai import OpenAI # New-style OpenAI client for Groq
|
| 6 |
|
| 7 |
+
# Set your Groq API key and base URL
|
| 8 |
+
client = OpenAI(
|
| 9 |
+
api_key="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", # Replace with your actual Groq API key
|
| 10 |
+
base_url="https://api.groq.com/openai/v1"
|
| 11 |
+
)
|
| 12 |
|
| 13 |
def extract_text_from_url(url):
|
| 14 |
try:
|
|
|
|
| 31 |
|
| 32 |
Write the new blog post:
|
| 33 |
"""
|
| 34 |
+
response = client.chat.completions.create(
|
| 35 |
model="llama3-70b-8192", # LLaMA 3 via Groq
|
| 36 |
messages=[
|
| 37 |
{"role": "system", "content": "You are an expert SEO content writer."},
|
|
|
|
| 40 |
temperature=0.7,
|
| 41 |
max_tokens=1500
|
| 42 |
)
|
| 43 |
+
return response.choices[0].message.content
|
| 44 |
|
| 45 |
def main():
|
| 46 |
st.title("📝 Pro SEO Blog Writer")
|