I getting this issue when use with API

#2
by colornative - opened

{
"error": "predict() got an unexpected keyword argument 'prompt'"
}

Journalists on Hugging Face org

@colornative Is it still the case? Should be fixed.

still going

{
"error": "predict() got an unexpected keyword argument 'prompt'"
}

this is my code

@app .route('/scrape', methods=['POST'])
def scrape_and_summarize():
try:
data = request.get_json()
prompt = data.get('prompt', 'List me all the press releases with their headlines and urls.')
source = data.get('source', 'https://www.whitehouse.gov/')

    client = Client("JournalistsonHF/ai-scraper")
    result = client.predict(
        prompt=prompt,
        source=source,
        api_name="/scrape_and_summarize"
    )
    
    return jsonify(result)
except Exception as e:
    return jsonify({"error": str(e)})

Sign up or log in to comment