INNER CODE UNIT · Python

fetch_wikipedia_page

maxpumperla/learning_ray · notebooks/app.py:68

def fetch_wikipedia_page(search_term: str) -> Optional[str]:
    results = wikipedia.search(search_term)
    # If no results, return to caller.
    if len(results) == 0:
        return None

    # Get the page for the top result.
    return wikipedia.page(results[0]).content


from ray import serve
from transformers import pipeline
from typing import List


@serve.deployment
class SentimentAnalysis:
    def __init__(self):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…